<form class="layui-form" lay-filter="form" id="form">
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">活动名称</label>
        <div class="layui-input-inline">
            <input type="text" name="title" lay-verify="required" lay-reqText="活动名称不能为空" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class="layui-input-inline">
            <input type="text" name="image" autocomplete="off" class="layui-input plupload_btn_input">
        </div>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <a href="{{ d.params.image || '' }}" target="_blank">
                    <img src="{{ d.params.image || '' }}" width="35" class="{{ d.params.image || 'layui-hide' }}">
                </a>
            </script>
            <button type="button" class="layui-btn layui-btn-sm plupload_btn" id="image"><i class="layui-icon sm_iconfont icon-yunshangchuan"></i>选择图片</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">优惠类型</label>
        <div class="layui-input-inline">
            <input type="radio" name="type" lay-filter="type" value="1" title="满减" lay-verify="required" checked>
            <input type="radio" name="type" lay-filter="type" value="2" title="折扣" lay-verify="required">
        </div>
        <label class="layui-form-label label-required-next">是否可购买</label>
        <div class="layui-input-inline">
            <input type="radio" name="is_buy" lay-filter="is_buy" value="0" title="否" lay-verify="required" checked>
            <input type="radio" name="is_buy" lay-filter="is_buy" value="1" title="是" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">开放领取</label>
        <div class="layui-input-inline">
            <input type="radio" name="open" lay-filter="open" value="0" title="否" lay-verify="required" checked>
            <input type="radio" name="open" lay-filter="open" value="1" title="是" lay-verify="required">
        </div>
        <label class="layui-form-label label-required-next">领取张数</label>
        <div class="layui-input-inline">
            <input type="text" name="limit" lay-verify="number" value="0" lay-reqText="领取张数不能为空" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">0为不限制</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">起用金额</label>
        <div class="layui-input-inline">
            <input type="text" name="use_price" lay-verify="price" lay-reqText="起用金额格式错误" autocomplete="off" class="layui-input">
        </div>
        <label class="layui-form-label label-required-next">优惠</label>
        <div class="layui-input-inline">
            <input type="text" name="amount" lay-verify="price" lay-reqText="优惠格式错误" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux amount_prompt">元/折</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">有效天数</label>
        <div class="layui-input-inline">
            <input type="text" name="day_num" lay-verify="day_num" value="0" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux amount_prompt">设置了有效天数后开始结束时间不起作用，从领取时间开始算</div>
    </div>
    <div class="layui-form-item" id="select_at">
        <label class="layui-form-label label-required-next">起止时间</label>
        <div class="layui-input-inline">
            <input type="text" name="start_at" id="start_at" autocomplete="off" class="layui-input" readonly>
        </div>
        <div class="layui-form-mid layui-word-aux">-</div>
        <div class="layui-input-inline">
            <input type="text" name="end_at" id="end_at" autocomplete="off" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">简介</label>
        <div class="layui-input-block">
            <textarea name="note" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="hidden" name="id" value="">
            <input type="button" lay-submit lay-filter="form-submit" value="确认" class="layui-btn">
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="../../../../layuiadmin/lib/plupload/plupload.full.min.js"></script>
<script src="../../../../layuiadmin/lib/plupload/i18n/zh_CN.js"></script>
<script>
    layui.use(['plupload', 'verify'], function () {
        let $ = layui.$,
            plupload = layui.plupload,
            laydate = layui.laydate;

        plupload.init();//初始化上传

        //日期
        laydate.render({
            elem: '#select_at',
            type: 'datetime',
            range: ['#start_at', '#end_at']
        });
    });
</script>